PHP converts time to several functions and classes several minutes ago, several hours ago, and a few days ago. This article mainly introduces several functions of php computing several minutes ago, several hours ago, and a few days ago., class
This article mainly introduces several functions and classes of php computing several minutes ago, several hours ago, and a few days ago. For more information, see
This article mainly introduces several functions and classes of php computing several
This article mainly introduces PHP calculation time a few ago, a few hours ago, a few days ago several functions, class sharing, the need for friends can refer to the next
First, the function realization
Example 1:
Example 2:
Example 3
Php timeline function, which is a common time processing function in php just one minute ago, one hour ago, or one day ago: time (): returns the current Unix timestamp ?. Date (): format a local time/date. Getdate (): Get date/time information.
Php returns the relative time (such as: 20 minutes ago, 3 days ago) method, php days ago
This example describes how php returns relative time (for example, 20 minutes ago, 3 days ago. Share it with you for your reference. The details are as follows:
Timestamp is a small feature that we often use in comparison of time and date, next, I will introduce some methods for converting the strtotime Timestamp and use it to format a date several minutes, several hours ago, or several days ago. Timestamp
The date format of php processing is seconds ago, minutes ago, hours ago, yesterday, and the day before yesterday. *** modify the date format to different display styles according to the following rules * The number of seconds before Display is less
The date format of php processing is seconds ago, minutes ago, hours ago, yesterday, and the day before yesterday. *** modify the date format to different display styles according to the following rules * The number of seconds before Display is less
/** Friendly time display * * @param int $sTime time to display * @param string $type type. Normal | mohu | full | ymd | ot Her * @param string $alt expired * @return string*/ functionFriendlydate ($sTime,$type= ' normal ',$alt= ' false ') {
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.